package com.example.webdemo.common;

import lombok.Getter;

/**
 * @description: 统一返回码
 * @author zp
 * @date: 2023/6/24 16:42
 */
@Getter
public enum ResultCodeEnum{

    /**
     * success
     */
    SUCCESS(0,"操作成功"),
    /**
     * fail
     */
    FAIL(-1,"操作失败"),

    /**
     * 参数错误：1001-1999
     */
    PARAM_IS_INVALID(1001,"参数无效"),
    PARAM_TYPE_ERROR(1002,"参数类型错误"),

    USER_PHONE_NULL(1003,"登入手机号码为空"),
    USER_CODE_NULL(1004,"登入验证码为空"),
    USER_PASSWORD_NULL(1005,"登入密码为空"),
    USER_CODE_ERROR(1006,"登入验证码错误"),
    USER_PHONE(1007,"登入手机号码错误"),
    NOT_LOGIN(1008,"未登入请先登入后访问"),
    NOT_SEND_CODE(1009,"验证码未发送"),
    UPDATE_IMAGE_FAIL(1010,"图片上传失败"),
    UPDATE_IMAGE_NULL(1011,"上传文件为空，请重新上传"),
    UPDATE_IMAGE_SIZE_ERROR(1012,"上传文件超过3MB，请重新上传"),
    UPDATE_IMAGE_TYPE_ERROR(1013,"上传文件格式错误，请重新上传"),
    DELETE_IMAGE_NULL(1014,"删除文件路径为空"),
    DELETE_IMAGE_FILE_NULL(1015,"删除文件不存在"),
    ERROR_SAVE_ARTICLE_INFO(1016,"保存发布文章错误"),
    GET_ARTICLE_INFO_ERROR(1017,"获取文章详情错误 文章id不能为空"),
    GET_ARTICLE_INFO_NULL(1018,"获取文章详情失败 文章不存在"),
    ADD_ARTICLE_POPULARITY_ERROR(1019,"未登入，无法点赞收藏和转发"),
    ARTICLE_POPULARITY_ERROR(1020,"点赞收藏转发错误"),
    ADD_ARTICLE_POPULARITY_REPEAT(1021,"同一个账号，无法重复点赞收藏和转发"),
    ADD_ARTICLE_POPULARITY_NULL(1022,"点赞收藏转发的文章不存在"),
    ADD_ARTICLE_POPULARITY_TYPE_NULL(1023,"点赞收藏转发 类型错误"),
    DELETE_ARTICLE_POPULARITY_REPEAT(1024,"取消 点赞收藏和转发失败"),
    DELETE_ARTICLE_POPULARITY_ERROR(1025,"取消 点赞收藏转发错误"),
    PAGING_ERROR(1026,"分页错误"),

    SYSTEM_ERROR(9999,"系统错误"),
    ;

    /**
     * 状态码
     */
    private final int code;

    /**
     * 提示信息
     */
    private final String message;

    ResultCodeEnum(Integer code, String message){
        this.code = code;
        this.message = message;
    }
}

